-
-
Notifications
You must be signed in to change notification settings - Fork 246
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Cache Intl.*
constructors
#1193
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@@ -63,6 +63,7 @@ | |||
"formatting" | |||
], | |||
"dependencies": { | |||
"@formatjs/fast-memoize": "^2.2.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Already in use due to intl-messageformat
@@ -120,27 +120,27 @@ | |||
"size-limit": [ | |||
{ | |||
"path": "dist/production/index.react-client.js", | |||
"limit": "15.785 KB" | |||
"limit": "16.055 KB" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added a note to #779 to make sure we target modern browsers, currently we're compiling too much syntax (e.g. rest params).
Fixes #215
Intl.*
constructors likeIntl.DateTimeFormat
are now cached across components in order to improve rendering performance (see benchmark).Details:
Intl.*
constructors..format
calls are currently not cached. The reason is that whileIntl.*
constructor caching can work across various component instances and formatting calls,.format
calls typically only affect a single call site. The overhead of memoization (serialization of args, diffing, bundle size) therefore might not be a good tradeoff here. In this area, avoiding re-renders is much more relevant, with the ideal solution being React Compiler.